home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MATH.SWG / 0056_Super Fast Pi.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  644b  |  24 lines

  1. {
  2. This is a small program which is faster than any of the writings on the echo
  3. on calculating Pi.  It uses some Calculus (In an exam I did 2/3 weeks ago).
  4. }
  5.  
  6. Program CalcPi;
  7. {$N+,E+}
  8.  
  9. Var
  10.   Result : Extended;
  11.   A      : Byte;
  12.  
  13. begin
  14.   Result := 3; {Needs a approximation of Pi}
  15.   For A := 1 to 3 do {Only needs three goes to get as accurate as possible
  16.                       with TP variables.}
  17.   begin
  18.     RESULT := RESULT - Sin(result) * Cos(result);
  19.     {this is a simplified version of Newton Raphson Elimation using Tan(Pi)=0}
  20.     Writeln(RESULT : 0 : 18);
  21.     {18 decimal places - as good as TP gets }
  22.   end;
  23. end.
  24.